import java.util.Scanner;

public class DAY0410 {
    //斐波那契数
    //不到6位，输出该数，到六位输出后六位数
    public static void main1(String[] args) {
        Scanner sc=new Scanner(System.in);
        long[] nums=new long[100000];
        //先存储这些数
        nums[0]=1;
        nums[1]=2;
        int flog=-1;
        for (int i = 2; i <100000 ; i++) {
            long temp=nums[i-1]+nums[i-2];
            //判断是否超过6位
            if(flog==-1&&temp>=100000){
                flog=i+1;
            }
            nums[i]=temp%1000000;
        }
        //读取这个数，查找
        while (sc.hasNextInt()){
            int n=sc.nextInt();
            long i=nums[n-1];
            //超过6位输出它的后6位
            if(n<flog){
                System.out.printf("%d\n",i);
            }else {
                System.out.printf("%6d\n",i);
            }
        }
    }



    public static void main(String[] args) {
        int F_year=0,F_month=0,F_day=0,T_year=0,T_month=0,T_day=0;
        Scanner sc=new Scanner(System.in);
        while (sc.hasNextInt()){
            F_year=sc.nextInt();
            F_month=sc.nextInt();
            F_day=sc.nextInt();
            T_year=sc.nextInt();
            T_month=sc.nextInt();
            T_day=sc.nextInt();
            int income=0;
            income=OneYearIncome(F_year)-Income(F_year,F_month,F_day-1);
            income=income+Income(T_year,T_month,T_day);
            //如果开始和结束在一年
            if(F_year==T_year){
                income-=OneYearIncome(F_year);
            }
            for (int i = F_year+1; i <T_year ; i++) {
                income+=OneYearIncome(i);
            }
            System.out.println(income);
        }
    }
    //是否为闰年
    private static boolean LeapYear(int year){
        if(year%400==0||(year%100!=0&&year%4==0))
            return true;
        return false;
    }
    //整年里一共能赚多少
    private static int OneYearIncome(int year){
        //一年12月 素数有2，3，5，7，11
        // 1，3，5，7，8,10，12是31天  2判断 4 6 9 11是30天
        int sum=2*31+//1
                1*28+//2
                1*31+//3
                2*30+//4
                1*31+//5
                2*30+//6
                1*31+//7
                2*31+//8
                2*30+//9
                2*31+//10
                1*30+//11
                2*31+//12
                (LeapYear(2)?1:0);// 2

        return sum;
    }
    //月份是否是素数
    private static boolean PrimeNumber(int month){
        return month==2||month==3||month==5||month==7||month==11;
    }
    //计算某年开始到同年某月某日的收益
    private static int Income(int year,int month,int day){
        int incom=0;
        if(!PrimeNumber(month)){
            incom=day*2;
        }else
            incom=day;

        while (--month>0){
            switch (month){
                case 1: case 8: case 10: case 12:
                    incom+=62;
                    break;
                case 3: case 5: case 7:
                    incom+=31;
                    break;
                case 4: case 6: case 9:
                    incom+=60;
                    break;
                case 11:
                    incom+=30;
                    break;
                default:
                    incom+=(28+(LeapYear(year)?1:0));
                    break;
            }
        }
        return incom;
    }
}
